-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Python: Add samples syntax checking with pyright #3710
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
This PR adds syntax checking for Python samples using pyright with a relaxed configuration that validates imports and attribute access without strict type checking. The PR includes the pyright configuration, build task integration, and fixes to 78 sample errors related to import reorganization and API changes.
Changes:
- Added
pyrightconfig.samples.jsonwith relaxed type checking configuration - Added
samples-syntaxpoe task and integrated it intocheckandpre-commit-checkworkflows - Updated samples to import workflow builders from
agent_framework_orchestrationspackage - Changed content type checking from
isinstance()to.typeproperty comparisons - Updated API usage for
normalize_messages,ChatMessage.text,Role,Annotationaccess patterns, andContentfactory methods
Reviewed changes
Copilot reviewed 45 out of 45 changed files in this pull request and generated 8 comments.
Show a summary per file
| File | Description |
|---|---|
| python/pyrightconfig.samples.json | New pyright configuration for sample validation with import/attribute checking |
| python/pyproject.toml | Added samples-syntax task and integrated into check/pre-commit workflows |
| python/AGENTS.md | Documentation for samples syntax checking process and exclusions |
| python/samples/getting_started/workflows/*/*.py | Updated imports from agent_framework to agent_framework_orchestrations for builders |
| python/samples/getting_started/tools/*.py | Changed isinstance checks to content.type comparisons |
| python/samples/getting_started/orchestrations/*.py | Updated imports and role access patterns |
| python/samples/getting_started/agents/*/*.py | Updated Content factory method usage and annotation access patterns |
| python/samples/getting_started/context_providers/*.py | Changed msg.content to msg.text |
| python/samples/demos/*/*.py | Updated to use ExecutorEvent instead of AgentRunUpdateEvent |
| python/samples/autogen-migration/*/*.py | Updated imports and content type checking patterns |
python/samples/getting_started/agents/anthropic/anthropic_advanced.py
Outdated
Show resolved
Hide resolved
python/samples/getting_started/agents/anthropic/anthropic_foundry.py
Outdated
Show resolved
Hide resolved
python/samples/getting_started/tools/function_tool_recover_from_failures.py
Outdated
Show resolved
Hide resolved
python/samples/getting_started/tools/function_tool_with_max_exceptions.py
Outdated
Show resolved
Hide resolved
python/samples/getting_started/tools/function_tool_with_max_invocations.py
Outdated
Show resolved
Hide resolved
python/samples/getting_started/workflows/agents/concurrent_workflow_as_agent.py
Show resolved
Hide resolved
5cb028c to
e8abeed
Compare
Python Test Coverage Report •
Python Unit Test Overview
|
||||||||||||||||||||||||||||||
python/samples/autogen-migration/orchestrations/01_round_robin_group_chat.py
Outdated
Show resolved
Hide resolved
python/samples/autogen-migration/orchestrations/01_round_robin_group_chat.py
Outdated
Show resolved
Hide resolved
python/samples/getting_started/workflows/agents/handoff_workflow_as_agent.py
Show resolved
Hide resolved
ca9468a to
96d92ec
Compare
- Add pyrightconfig.samples.json with relaxed type checking but import validation - Add samples-syntax poe task to check samples for syntax and import errors - Add samples-syntax to check and pre-commit-check tasks - Fix 78 sample errors: - Update workflow builder imports to use agent_framework_orchestrations - Change content type isinstance checks to content.type comparisons - Use Content factory methods instead of removed content type classes - Fix TypedDict access patterns for Annotation - Fix various API mismatches (normalize_messages, ChatMessage.text, role)
e2bc95e to
50220cd
Compare
Motivation and Context
Description
Contribution Checklist